package cn.pdx.elec.web.action;



import java.util.List;

import cn.pdx.elec.container.ServiceProvider;
import cn.pdx.elec.service.ElecCommonMsgService;
import cn.pdx.elec.web.form.ElecCommonMsgForm;

import com.opensymphony.xwork2.ModelDriven;

/**
 * implements ModelDriven<T>实现这个接口，泛型
 * ModelDriven<ElecCommonMsgForm>表示这个表单对象
 * @author 彭定旭
 *
 */
@SuppressWarnings("serial")
public class ElecCommonMsgAction extends BaseAction implements  ModelDriven<ElecCommonMsgForm>{
    
	/**
	 * 创建一个表单对象，对应页面的属性的对象
	 */
	private ElecCommonMsgForm elecCommonMsgForm=new ElecCommonMsgForm();
	
	/**
	 * 使用方法调用ElecCommonMsgService.SERVICE_NAME 接口
	 */
	private ElecCommonMsgService elecCommonMsgService=(ElecCommonMsgService) ServiceProvider.getService(ElecCommonMsgService.SERVICE_NAME);
	
	
	public ElecCommonMsgForm getModel() {
		
		return elecCommonMsgForm;
	}
    
	/**
	 * @Name:home
	 * @Description:查询代办事宜列表
	 * @author 彭定旭
	 * @version：v1.00（版本号）
	 * @Create Date:2013-3-27(创建日期)
	 * @parameters:
	 * @return:String home  跳转到actingIndex.jsp
	 */
	public String home()
	{
		List<ElecCommonMsgForm> list=elecCommonMsgService.findElecCommonMsgList();
		
		request.setAttribute("commonList", list);
		
		return "home";
	}
	
	
	/**
	 * @Name:save
	 * @Description:保存代办事宜列表
	 * @author 彭定旭
	 * @version：v1.00（版本号）
	 * @Create Date:2013-3-28(创建日期)
	 * @parameters:
	 * @return:String save  重定向跳转到actingIndex.jsp
	 */
	public String save()
	{ 
		elecCommonMsgService.saveElecCommonMsg(elecCommonMsgForm);
		
       
		return "save";
	}
}
